package xin.alum.aim.config;

import io.netty.handler.codec.compression.ZlibWrapper;
import io.netty.handler.logging.LogLevel;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import xin.alum.aim.groups.ClusterProperties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import xin.alum.aim.model.proto.Packet;
import xin.alum.aim.util.GZipUtil;


/**
 * 描述：配置信息 实体
 *
 * @Author alum
 * @Date 2019/5/7 22:08
 **/
@Data
@RefreshScope
@ConfigurationProperties(prefix = "alum.aim")
public class AimProperties {
    /**
     * 是否启用
     */
    private boolean enable = true;

    /**
     * 是否启用SSL
     */
    private boolean ssl = false;

    /**
     * gzip压缩模式,默认不压缩
     */
    private GZipUtil.GZip gzip = GZipUtil.GZip.NONE;

    /**
     * Server Host 地址
     */
    private String host = "127.0.0.1";

    /**
     * Socekt监听端口号
     */
    private int port = 8090;

    /**
     * WebSocekt连接相对路径
     */
    private String path = "/ws";

    /**
     * TCP通信协议，若为Text，刚结尾分隔
     */
    private Packet.Agreement agreement = Packet.Agreement.Json;

    /**
     * AIM 日志记录级别
     * INFO 是所有有
     */
    private LogLevel log = LogLevel.WARN;

    /**
     * 空闲时间
     */
    private IdleTime idle = new IdleTime();

    /**
     * 集群启用配置
     */
    private ClusterProperties cluster = new ClusterProperties();


    /**
     * 线程池配置
     */
    private ThreadPool threads = new ThreadPool();
}
